﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TemplateMethodPattern.DemoTwo
{
    /// <summary>
    /// 抽象悍马模型
    /// </summary>
    public abstract class HummerModel
    {
        /// <summary>
        /// 发动
        /// </summary>
        public abstract void start();
        /// <summary>
        /// 停止
        /// </summary>
        public abstract void stop();
        /// <summary>
        /// 喇叭
        /// </summary>
        public abstract void alarm();
        /// <summary>
        /// 引擎
        /// </summary>
        public abstract void engineBoom();
        /// <summary>
        /// 跑
        /// </summary>
        public void run()
        {
            this.start();

            this.engineBoom();

            if (this.isAlarm())
            {
                this.alarm();
            }

            this.stop();
        }

        protected abstract bool isAlarm();
      


    }
}
